<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <div id="vm"><com-temp></com-temp>{{ msg }}</div>
        <script src="../vue.js"></script>
        <script>
            new Vue({
                el: '#vm',
                data() {
                    return {
                        msg: '按钮',
                    };
                },
                methods: {},
                components: {
                    // comTemp 是组件的名称, comTemp组件名是驼峰的时候,在写组件的时候就要用-:com-temp
                    comTemp: {
                        // render函数去渲染的
                        template: '<button @click="clickMe">{{msg}}</button>',
                        data() {
                            return {
                                msg: '按钮',
                            };
                        },
                        methods: {
                            clickMe() {
                                console.log('点击了...');
                            },
                        },
                        components: {},
                    },
                },
            });
        </script>
    </body>
</html>
